package cn.kk.librarysystem.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/*
 *@author KK on 2022.10.14 20:09
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@ToString
@Api(value = "学生类")
@TableName("student")
@ApiModel(value = "学生实体类",discriminator = "图书描述")
public class Student {
    @TableId(value = "id", type = IdType.AUTO)
    @ApiModelProperty(value = "主键id",example = "1")
    private int id;
    @ApiModelProperty(value = "学生姓名",example = "张三")
    private String name;
    @ApiModelProperty(value = "学生年龄",example = "12")
    private int age;
    @ApiModelProperty(value = "学生密码",example = "123323")
    private String password;

    public void setId(int id) {
        if (id < 0) {
            this.id = 0;
        } else {
            this.id = id;
        }
    }

    public Student(String name, int age, String password) {
        this.name = name;
        this.age = age;
        this.password = password;
    }
}